home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CDPD Public Domain Collection for CDTV 4
/
CDPD_IV.bin
/
e
/
mailinglists
/
amigae.0294feb.archive
/
000046_donews!crash!ts…c.EDU!usr1400a_Sat, 12 Feb 94 01:42:21 PST.msg
< prev
next >
Wrap
Internet Message Format
|
1994-05-26
|
2KB
Received: by bkhouse.cts.com (V1.17-beta/Amiga)
id <1t8c@bkhouse.cts.com>; Sat, 12 Feb 94 01:42:21 PST
Received: from crash by donews.cts.com with uucp
(Smail3.1.28.1 #18) id m0pVBYw-0001OsC; Fri, 11 Feb 94 23:02 EST
Received: from ROLL.SAN.UC.EDU by crash.cts.com with smtp
(Smail3.1.28.1 #18) id m0pVBLC-00003jC; Fri, 11 Feb 94 19:48 PST
Received: from tso.uc.edu by UCBEH.SAN.UC.EDU (PMDF V4.2-14 #4918) id
<01H8RY2GR8WW924V2N@UCBEH.SAN.UC.EDU>; Fri, 11 Feb 1994 22:46:20 EST
Received: by tso.uc.edu (4.1/SMI-4.1) id AA08956; Fri, 11 Feb 94 22:46:52 EST
Date: Fri, 11 Feb 1994 22:46:52 -0500 (EST)
Message-id: <9402120346.AA08956@tso.uc.edu>
Content-transfer-encoding: 7BIT
From: usr1400a@tso.uc.EDU (Carl Jolley)
To: amigae@bkhouse.cts.COM
Subject: Re: Bugs in the Mod() function
Bernie, In your message you said (in part):
> After a lot of debugging of code that ought to have worked, I
> discovered that the Mod function seems to be VERY broken. As we
> [ought to] all know, taking an integer mod N should *always* get you
> an integer between 0 and n-1. Well, it ain't so in E. A simple
> test reveals:
>
> Modulo: Mod(11,8) = 3
> Modulo: Mod(6,8) = 6
> Modulo: Mod(1,8) = 1
> Modulo: Mod(-4,8) = -4
> Modulo: Mod(-9,8) = -1
> Modulo: Mod(-14,8) = -6
>
> Which is clearly broken. In the course of pursuing this, I discovered
> that simple division ain't a prize, either:
>
> Dividing 11 / 8 = 1
> Dividing 6 / 8 = 0
> Dividing 1 / 8 = 0
> Dividing -4 / 8 = 0
> Dividing -9 / 8 = -1
> Dividing -14 / 8 = -1
>
> It is astounding to me to try to understand arithmetic in an environment
> where:
>
> (A - B) / B does *NOT* equal (A / B) - 1
Hmm, Bernie, I'm not sure what the last equation (or non-equation) has to
to do your assertion that the Mod function is broken. As I recall (it's been
a long time since I got my degree in Math) the Mod function involves the
sign of the division operation being applied to the absolute value of the
result. In any event, I've always used a a working definition of Mod to
be the remainder after integral division. It seems correct to me as does
the example "integer" division examples.